﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace KXmlUIControl
{
    /// <summary>
    /// 组成模块的页面对象配置节点(对应具体业务流程的每个页面)
    /// </summary>
    public class XmlPageObject
    {
         /// <summary>
        /// 模块内子对象的唯一标识符(int)
        /// </summary>
        public string ID { get; set; }

        /// <summary>
        /// 中文名称
        /// </summary>
        public string ChineseName { get; set; }

        /// <summary>
        /// 主窗口类型的完全限定名称
        /// </summary>
        public string TypeName { get; set; }

        /// <summary>
        /// 子窗口类型的完全限定名称
        /// </summary>
        public string ChildTypeName { get; set; }

        /// <summary>
        /// 存储的相对目录名称
        /// </summary>
        public string Directory { get; set; }
        
        /// <summary>
        /// 动态库的加载路径(相对路径)
        /// </summary>
        public string FileName { get; set; }     

        private bool _enabled = true;

        private bool _showChildForm = true;

        private bool _necessary = true;
       
        /// <summary>
        /// 是否启用
        /// </summary>
        public bool Enable
        { 
            get{ return _enabled; }
            set{ _enabled = value; }
        }

        /// <summary>
        /// 是否显示子页面
        /// </summary>
        public bool ShowChildForm
        {
            get { return _showChildForm; }
            set { _showChildForm = value; }
        }

        /// <summary>
        /// 是否是必要的
        /// </summary>
        public bool Necessary
        {
            get { return _necessary; }
            set { _necessary = value; }
        }

        /// <summary>
        /// 窗口大小
        /// </summary>
        public string Size
        {
            get;
            set;
        }

        public XmlPageObject()
        {

        }

        public Size GetPageSize()
        {
            if (string.IsNullOrEmpty(Size))
            {
                return new Size(1280, 800);
            }
            Size size = StaticTypes.GetSize(Size);
            if (size.IsEmpty)
            {
                return new Size(1280, 800);
            }
            return size;
        }

        public override string ToString()
        {
            return ChineseName;
        }
    }
}
